package main;

import java.util.Scanner;

public class Main {
   public static void main(String[] args){
   	Scanner input=new Scanner(System.in);
   	while(input.hasNextInt()){
   		int num=input.nextInt();
   		Person[] person=new Person[num];
   		for (int i=0;i<num;i++){
   			person[i]=new Person(input.next(),input.nextInt(),input.nextBoolean());
   		}
   		for (int k = num-1;k>=0;k--)
   			System.out.println(person[k]);
   		Person p = new Person();
   		System.out.println(p);
   	}

}
}